package com.cch.cooperation.api.common.config;

import com.baidu.aip.contentcensor.AipContentCensor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

import javax.annotation.Resource;


/**
 * 百度审核配置
 *
 * @author cch
 */
@Configuration
public class BaiDuConfiguration {

    @Resource
    private Environment environment;

    @Bean
    public AipContentCensor aipContentCensor() {
        String appId = environment.getProperty("app.baidu.check.app-id");
        String appKey = environment.getProperty("app.baidu.check.app-key");
        String appSecret = environment.getProperty("app.baidu.check.app-secret");
        return new AipContentCensor(appId, appKey, appSecret);
    }
}
